﻿@model IList<Shop.Page.Models.Other>
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>其他管理</title>
    <link href="~/Content/BootStrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Content/BootStrap/css/bootstrap-theme.min.css" rel="stylesheet" />
    <link href="~/Content/BootStrap/css/docs.min.css" rel="stylesheet" />
    <link href="~/bootstrapvalidator-master/dist/css/bootstrapValidator.min.css" rel="stylesheet" />

    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <script src="~/Content/BootStrap/js/bootstrap.min.js"></script>
    <script src="~/Content/BootStrap/js/docs.min.js"></script>
    <script src="~/bootstrapvalidator-master/dist/js/bootstrapValidator.min.js"></script>
    <script src="~/bootstrapvalidator-master/dist/js/language/zh_CN.js"></script>

    @*上传*@
    <script src="~/bootstrap-fileinput-master/js/fileinput.min.js"></script>
    <script src="~/bootstrap-fileinput-master/js/locales/zh.js"></script>
    <link href="~/bootstrap-fileinput-master/css/fileinput.min.css" rel="stylesheet" />
</head>
<body>
    <table class="table table-bordered table-striped table-hover">
        <tr>
            <td>#</td>
            <td>名</td>
            <td>内容</td>
            <td>操作</td>
        </tr>
        @for (int i = 0; i < Model.Count; i++)
        {
            if (Model[i].Type != 5)
            {
                <tr>
                    <td>@(i + 1)</td>
                    <td>@Model[i].Name</td>
                    <td>@Model[i].Value</td>
                    <td>
                        <input type="button" class="btn btn-default" value="修改" onclick="update('@Model[i].Type','@Model[i].Value')" />
                    </td>
                </tr>
            }
            else
            {
                <tr>
                    <td>@(i + 1)</td>
                    <td>@Model[i].Name</td>
                    <td>
                        <img src="@Model[i].Value" style="width:200px"/>
                    </td>
                    <td>
                        <input type="button" class="btn btn-default" value="修改" onclick="update('@Model[i].Type','@Model[i].Value')" />
                    </td>
                </tr>
            }
        }
    </table>
    <div class="modal fade bs-example-modal-lg" id="UpdateOther" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog modal-lg" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">修改</h4>
                </div>
                <form id="UpdateOtherInfo" method="post" class="form-horizontal" action="UpdateOtherInfo">
                    <input type="text" hidden="hidden" name="Type" id="Type" />
                    <div class="modal-body">
                        <div class="form-group">
                            <label class="col-lg-3 control-label">对应值</label>
                            <div class="col-lg-5">
                                <input type="text" class="form-control" name="Value" id="Value" placeholder="对应值" />
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <input type="button" class="btn btn-default" data-dismiss="modal" value="关闭" />
                        <input type="submit" class="btn btn-primary" value="确定" />
                    </div>
                </form>
            </div>
        </div>
    </div>
    <div class="modal fade bs-example-modal-lg" id="UpdateLogo" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog modal-lg" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">修改</h4>
                </div>
                <form id="UpdateLogoInfo" method="post" class="form-horizontal" action="UpdateLogoInfo" enctype="multipart/form-data">
                    <div class="modal-body">
                        <div class="form-group">
                            <label class="col-lg-3 control-label" for="LogoUrl">商品图片</label>
                            <div class="col-lg-5">
                                <input id="LogoUrl" name="LogoUrl" type="file" class="file-loading" multiple data-show-caption="true">
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <input type="button" class="btn btn-default" data-dismiss="modal" value="关闭" />
                        <input type="submit" class="btn btn-primary" value="确定" />
                    </div>
                </form>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(document).on('ready', function () {
            $("#LogoUrl").fileinput({
                language: 'zh', //设置语言
                uploadUrl: "", //上传的地址
                allowedFileExtensions: ['jpg', 'png', 'gif'],//接收的文件后缀
                showUpload: false, //是否显示上传按钮
                showCaption: false,//是否显示标题
                browseClass: "btn btn-primary", //按钮样式
                previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
                maxFileSize: 2000,
            });
        });
        function update(Type, Value) {
            if (Type == 5)
            {
                $("#UpdateLogo").modal();
            }
            else
            {
                $("#Type").val(Type);
                $("#Value").val(Value);
                $("#UpdateOther").modal();
            }
        }
    </script>
</body>
</html>
